/**********************************************************************
 * Project : WoWGuildRoster (http://www.codeplex.com/WowGuildRoster/)
 * Module  : DotNetWarcraft.WoWGuildRoster.Data.DataProvider
 **********************************************************************
 * 
 * 
 * 
 **********************************************************************
 * License : All code is subject to licensing terms per the Microsoft
 *   Permissive License (Ms-PL) v1.1. For full license information,
 *   refer to the packaged license.txt file.
 **********************************************************************
 * Revision History:
 * -----------------
 * 2007-07-29 -- Cliff Simpkins: Initial Version
 * 2007-12-26 -- Cliff Simpkins: Adding Delete Error and Data Load calls
 **********************************************************************
 */
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

using Microsoft.ApplicationBlocks.Data;
using DotNetWarcraft.WoWGuildRoster.Business;

namespace DotNetWarcraft.WoWGuildRoster.Data {
  public abstract class DataProvider {
    protected string _connectionString;
    public String ConnectionString {
      get {
        return _connectionString;
      }
      set {
        _connectionString = value;
      }
    }

    #region Shared/Static Methods
    // singleton reference to the instantiated object 
    protected static DataProvider objProvider = null;

    // constructor
    static DataProvider() {
      CreateProvider();
    }

    // dynamically create provider
    protected static void CreateProvider() {
      objProvider = new SqlDataProvider();
    }

    // return the provider
    public static DataProvider Instance() {
      return objProvider;
    }

    #endregion

    public abstract List<GuildError> GetErrors();
    public abstract GuildError GetError(int ErrorId);
    public abstract bool DeleteErrors();
    public abstract bool DeleteErrors(int RosterId);
    public abstract bool DeleteError(int ErrorId);

    internal abstract void AddError(DotNetWarcraft.WoWGuildRoster.Business.Exceptions.WoWGuildRosterException error);

    public abstract DataSet GetRostersDS();

    public abstract List<GuildRoster> GetRosters();
    public abstract GuildRoster GetRoster(int RosterId);
    public abstract int AddRoster(GuildRoster objWoWGuildRoster);
    public abstract bool UpdateRoster(GuildRoster objWoWGuildRoster);
    public abstract bool DeleteRoster(int RosterId);
    public abstract void ProcessGuildEntries_MarkRosterUnprocessed(int RosterID);
    public abstract void ProcessGuildEntries_MarkPriorUnprocessed(int RosterID, DateTime LoadTimeStart);
    public abstract void ProcessGuildEntries_MarkPriorUnprocessed(int RosterID, int LoadID);
    public abstract void ProcessGuildEntries_MarkForReload(int RosterID);


    public abstract List<GuildEntry> GetCharEntries();
    public abstract List<GuildEntry> GetCharEntries(int RosterID);
    public abstract List<GuildEntry> GetCharEntries(int RosterID, int LevelRange_Min, int LevelRange_Max);
    public abstract List<GuildEntry> GetCharEntries(bool currentEntriesOnly);
    public abstract List<GuildEntry> GetCharEntries_Alts(int mainCharID);
    public abstract GuildEntry GetCharEntry(int entryID);
    public abstract GuildEntry GetCharEntry(String charName, String serverName);
    public abstract int AddCharEntry(GuildEntry objCharEntry);
    public abstract bool UpdateCharEntry(GuildEntry objCharEntry);
    public abstract bool DeleteCharEntry(int entryID);

    public abstract List<GuildEntryStat> GetCharEntryStats();
    public abstract List<GuildEntryStat> GetCharEntryStats_ByCharEntry(int entryID);
    public abstract List<GuildEntryStat> GetCharEntryStats_ByCharEntryAndType(int entryID, WarcraftStatTypes statTypeEnum);
    public abstract List<GuildEntryStat> GetCharEntryStats_ByCharEntryAndType(int entryID, int statTypeID);
    public abstract List<GuildEntryStat> GetCharEntryStats_ByCharEntryAndTypeAndGroup(int entryID, WarcraftStatTypes statTypeEnum, String statGroup);
    public abstract List<GuildEntryStat> GetCharEntryStats_ByCharEntryAndTypeAndGroup(int entryID, int statTypeID, String statGroup);
    public abstract GuildEntryStat GetCharEntryStat(int entryStatID);
    public abstract GuildEntryStat GetCharEntryStat(int charID, int statType, String statGroup, String statEntry);
    public abstract int AddUpdateCharEntryStat(GuildEntryStat objGuildEntry);
    public abstract bool DeleteCharEntryStat(int entryStatID);
    public abstract bool DeleteCharEntryStats_ByChar(int entryID);
    public abstract bool DeleteCharEntryStats_ByChar(int entryID, WarcraftStatTypes statTypeEnum);
    public abstract bool DeleteCharEntryStats_ByChar(int entryID, int statTypeID);

    public abstract List<QuickStatListItem> GetEntryStatsLIs_ByGuildRank(int guildRank, bool mainsOnly);
    public abstract List<QuickStatListItem> GetEntryStatsLIs_ByStatEntryAndType(String statEntry, WarcraftStatTypes statTypeEnum, bool mainsOnly);
    public abstract List<QuickStatListItem> GetEntryStatsLIs_ByStatEntryAndType(String statEntry, int statTypeID, bool mainsOnly);
    public abstract List<QuickStatListItem> GetEntryStatsLIs_ByStatEntryAndTypeAndGroup(String statEntry, String statGroup, WarcraftStatTypes statTypeEnum, bool mainsOnly);
    public abstract List<QuickStatListItem> GetEntryStatsLIs_ByStatEntryAndTypeAndGroup(String statEntry, String statGroup, int statTypeID, bool mainsOnly);

    public abstract List<DataLoad> GetDataLoads();
    public abstract DataLoad GetDataLoad(int loadID);
    public abstract DataLoad GetDataLoad_CurrentCharLoad();
    public abstract int AddDataLoad(DataLoad objDataLoad);
    public abstract bool UpdateDataLoad(DataLoad objDataLoad);
    public abstract bool DeleteDataLoads();
    public abstract bool DeleteDataLoad(int loadID);

    public abstract List<String> GetDropDowns_CharClasses();
    public abstract List<String> GetDropDowns_CharProfessions();
    public abstract List<String> GetDropDowns_Reputations();
    public abstract List<String> GetDropDowns_ReputationGroups(int charID);

  }
}
